package ru.nosport.matrixaria.modules.core.rmreg;

import ru.nosport.matrixaria.modules.common.AppServerProcess;
import ru.nosport.matrixaria.core.ModuleShortcut;
import ru.nosport.matrixaria.core.CoreModule;
import ru.nosport.matrixaria.core.MessageHandler;
import ru.nosport.matrixaria.core.MessageHandlerException;
import org.apache.commons.configuration.Configuration;

/**
 * User: Victor Fabrichenko
 * Date: 28.04.2009
 * Time: 16:05:03
 */
public class RemoteModuleRegistrationApp implements RemoteModuleRegistration, AppServerProcess, CoreModule {

	public RemoteModuleRegistrationApp(Configuration _conf){}

	public boolean moduleStart() throws Exception {
		return false;
	}

	public boolean moduleStop() {
		return false;
	}

	public boolean isModuleRunning() {
		return false;
	}

	public String moduleStat() {
		return null;
	}

	public boolean registration(ModuleShortcut _module) {
		try{
			MessageHandler.regModule(this, _module);
		}catch(MessageHandlerException ex){
			// todo logging
			return false;
		}

		return true;
	}

	public boolean exists(ModuleShortcut _module){
		return MessageHandler.existsModule(_module.getInstanceName());
	}
}
